#ifndef ROOM_H
#define ROOM_H

#include "GameObject.h"

#include <string>
#include <vector>
#include <windows.h>

class Player;

class Room : public GameObject
{
public:
	struct ThreadData
	{
		Room* room;
		GameObject* gameObject;
	};

	enum Content
	{
		Content_Monster,
		Content_GoldBag,
		Content_GateKey
	};

	enum Action
	{
		Action_Attack,
		Action_Take,
		Action_Exit
	};

	Room(int x, int y);

	virtual bool isPassable(const GameObject* gameObject) const;
	virtual void handleCollision(GameObject* gameObject);

	virtual void setDrawColor() const {setColor(0.737,0.376,0.176);} //{setColor(0.6f, 0.6f, 0.6f);}
	virtual void drawObject(int row, int col) const;

	// One of the rooms on the map will be assigned a gate key.
	void addGateKey();
	
private:
	// Functions to handle the player in the room
	void printContent() const;
	std::string getActions() const;
	std::string getAttackableContent() const;
	std::string getTakeableContent() const;
	bool roomContains(Content contentToFind) const;
	void removeContent(Content contentToRemove);

	static std::string getDescription(Content content);
	static std::string getName(Content content);
	static std::string getName(Action action);

	void addRandomContent();

	// Function to be called by thread.
	static DWORD WINAPI handlePlayerInRoom(LPVOID n);
	void handlePlayerInRoom(Player* player);
	void handleTake(Player* player);
	void handleAttack(Player* player);

	std::vector<Content> content;

	ThreadData threadData;
};

#endif